package bookStore.tool;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DbConnectionUtil {
	private DbConnectionUtil() {}
	
	private static DbConnectionUtil instance = new DbConnectionUtil();
	
	private static Connection connection;
	
	static {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/book_store?useUnicode=true&characterEncoding=utf8",
					"root", "123456");
		} catch (ClassNotFoundException | SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
	
	public static DbConnectionUtil getInstance() {
		return instance;
	}
	
	public Connection getConnevtion() {
		return connection;
	}

	
}
